package com.ygqh.baby.service;

import java.io.File;
import java.io.InputStream;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.multipart.MultipartFile;

import com.ygqh.baby.ao.FileType;

public interface FileService {
	String upload2Oss(final FileType fileType, MultipartFile file);

	String upload2Oss(final FileType fileType, final byte[] bytes);

	void upload2Oss(final String key, byte[] bytes);

	/**
	 * 上传专题临时页面
	 * @param key 专题临时页面保存地址
	 * @param filePath 需要上传的文件路径
	 */
	void uploadHtml2Oss(final String key, String filePath);

	byte[] downloadFromOss(String key);

	InputStream downloadIOFromOss(String key);

	String getUploadImageKey(FileType type, String originalFileName, String fileName);

	/**
	 * 根据FileType上传图片,并自动裁切
	 * @param uploadFile
	 * @param fileType
	 * @param request
	 * @return
	 * @throws Exception
	 */
	String uploadImage(MultipartFile uploadFile, FileType[] fileType, HttpServletRequest request, Boolean isFill) throws Exception;

	/**
	 * 上传Base64格式图片
	 * @param uploadFile
	 * @param fileType
	 * @param extName
	 * @param isFill
	 * @param request
	 * @return
	 * @throws Exception
	 */
	String uploadImage(File uploadFile, FileType[] fileType, String extName, Boolean isFill, HttpServletRequest request) throws Exception;

	/**
	 * 上传Base64格式图片
	 * @param uploadFile
	 * @param fileType
	 * @param extName
	 * @param isFill
	 * @param request
	 * @return
	 * @throws Exception
	 */
	String uploadImage(File uploadFile, FileType fileType, Boolean isFill) throws Exception;

	/**
	 * 根据专题的临时地址复制到正式目录下
	 * @param sourceHtml 原文件路径
	 * @param targetHtml 目标文件路径
	 */
	void uploadTemplateHtml2Target(String sourceHtml, String targetHtml);

	String upload2Oss(FileType fileType, MultipartFile file, String fileName);

	String uploadAliaImage(String path, FileType fileType, Boolean isFill) throws Exception;

	String uploadQrcode(String key,MultipartFile uploadFile, HttpServletRequest request)
			throws Exception;

}
